#define _CRT_SECURE_NO_WARNINGS
#include <stdio.h>
#include <stdbool.h>

bool is_leap_year(int y)
{
	return (y % 4 == 0 && y % 100 != 0) || y % 400 == 0;
}

int get_days_of_month(int y, int m)
{
	int days[13] = { 0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 };
	int d = days[m];
	if (is_leap_year(y) && m == 2)
		d += 1;
}

int main()
{
	int year = 0, month = 0;
	scanf("%d %d", &year, &month);
	printf("%d\n",get_days_of_month(year, month));
	return 0;
}
